/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package composants;

import java.util.Observable;

/**
 *
 * @author Valentin
 */
public class Roue extends Observable{


	final static int positionMin=0;
	private int position=0;
	final static int positionMax=100;




	public Roue()
	{
		this.position=0;
	}

	public Roue(int position)
	{
		this.position=position;
		if(this.getPosition() > positionMax ) this.position=positionMax;
		if(this.getPosition() < positionMin ) this.position=positionMin;
	}

	public boolean isMax()
	{
		if(position==positionMax)
		{
			return true;
		}
		return false;
	}

	public boolean isMin()
	{
		if(position==positionMin)
		{
			return true;
		}
		return false;
	}

	public boolean lever_roue()
	{
		if(this.getPosition() < positionMax )
		{
			this.setPosition(this.getPosition() + 1);
			this.setChanged();
			this.notifyObservers(this);
			return true;
		}
		return false;
	}

	public boolean baisser_roue()
	{
		if(this.getPosition() > positionMin )
		{
			this.setPosition(this.getPosition() - 1);
			this.setChanged();
			this.notifyObservers(this);
			return true;
		}
		return false;

	}


	public int getPosition() {
		return position;
	}


	public void setPosition(int position) {
		this.position = position;
	}





}
